package it.polimi.jita.cp.block.de;

import it.polimi.jita.cp.block.Output;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class DemandEstimatorOutput extends Output {
	private final List<IInstantDemandEstimatorData> instants;
	private Double maxCapacityDemand;
	private Histogram histogram;

	public DemandEstimatorOutput(List<IInstantDemandEstimatorData> instants,
			Histogram histogram) {
		super();
		this.instants = instants;
		this.histogram = histogram;
	}

	public List<IInstantDemandEstimatorData> getDemandEstimation() {
		return Collections.unmodifiableList(instants);
	}

	public Double getMaxCapacityDemand() {
		Double max = 0d;
		for (IInstantDemandEstimatorData i : instants) {
			if (i.getDemand()>max)
				max = i.getDemand();
		}
		maxCapacityDemand = max.doubleValue();
		return maxCapacityDemand;
	}

	public Histogram getHistogram() {
		return histogram;
	}

	public List<Double> getDemandEstimationDbl() {
		List<Double> demandEstimation = new ArrayList<>();
		for (IInstantDemandEstimatorData iInstantDemandEstimatorData : instants) {
			demandEstimation.add(iInstantDemandEstimatorData.getDemand()
					.doubleValue());
		}
		return demandEstimation;
	}

}
